package com.hangzhou.welbeing.welbeinginstrument.activity;

import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hangzhou.welbeing.welbeinginstrument.R;
import com.hangzhou.welbeing.welbeinginstrument.utils.Utils;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * 杭州惟君医疗科技有限公司17
 * Created by 20433 on 2018/1/29
 */

public class TaoBaoActivity extends Activity {
    @Bind(R.id.activit_tao_bao_tv_titile)
    TextView activitTaoBaoTvTitile;
    @Bind(R.id.activit_tao_bao_iv_return)
    ImageView activitTaoBaoIvReturn;
    @Bind(R.id.fragment_find_rl_man_near)
    RelativeLayout fragmentFindRlManNear;
    @Bind(R.id.activit_tao_bao_webview)
    WebView activitTaoBaoWebview;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activit_tao_bao);
        ButterKnife.bind(this);
        Utils.setStatusBar(this,false,false);
        Utils.setStatusTextColor(true,this);
        String strcon = getIntent().getStringExtra("strcon");
        activitTaoBaoIvReturn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
                overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
            }
        });

        activitTaoBaoWebview.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                super.onPageStarted(view, url, favicon);
            }
        });
        WebChromeClient wvcc = new WebChromeClient() {
            @Override
            public void onReceivedTitle(WebView view, String title) {
                super.onReceivedTitle(view, title);
                activitTaoBaoTvTitile.setText(title);
            }

        };

        WebSettings webSettings = activitTaoBaoWebview.getSettings();
//支持js
        webSettings.setJavaScriptEnabled(true);
//支持对网页缩放
        webSettings.setSupportZoom(true);
//支持android4.0
        webSettings.setBuiltInZoomControls(true);
        webSettings.setDisplayZoomControls(false); //隐藏原生的缩放控件
//默认缩放模式
        webSettings.setDefaultZoom(WebSettings.ZoomDensity.CLOSE);
        activitTaoBaoWebview.setInitialScale(100);
        activitTaoBaoWebview.setHorizontalScrollBarEnabled(false);//水平不显示
        activitTaoBaoWebview.setVerticalScrollBarEnabled(false); //垂直不显示

// 设置setWebChromeClient对象
        activitTaoBaoWebview.setWebChromeClient(wvcc);
        activitTaoBaoWebview.loadUrl(strcon);

    }
}
